package com.hr.牛客网剑指offer;

/**
 * @author zhz
 * @date 2020/08/23
 **/
public class JZ13_调整数组顺序使奇数位于偶数面前 {
    public void reOrderArray(int[] array) {
        if (array.length == 0) {
            return;
        }
        int length = array.length;
        int odd = 0;
        int even = 0;      //even用于遍历数组使用，odd用于定位
        while (even < length) {
            if (array[even] % 2 != 0) {
                int temp = array[even];
                for (int i = even; i > odd; i--) {
                    array[i] = array[i - 1];
                }
                array[odd] = temp;
                odd++;
                even++;
            } else {
                even++;
            }
        }
    }
    public void reOrderArray1(int[] array) {
        if (array.length==0){
            return;
        }
        int low=0;
        int high=array.length;
        while (low<high){
            if (array[low]%2!=0){

            }
        }

    }
}